﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace XEvents.Library
{
    internal struct dm_xe_session_object_column
    {
        internal string event_session_address;
        internal string column_name;
        internal int column_id;
        internal string column_value;
        internal string object_type;
        internal string object_name;
        internal Guid object_package_guid;

        internal dm_xe_session_object_column(SqlDataReader dr)
        {
            event_session_address = (dr["event_session_address"] == DBNull.Value ? string.Empty : dr["event_session_address"]).ToString();
            column_name = (dr["column_name"] == DBNull.Value ? string.Empty : dr["column_name"]).ToString();
            Int32.TryParse((dr["column_id"] == DBNull.Value ? "-1" : dr["column_id"]).ToString(), out column_id);
            column_value = (dr["column_value"] == DBNull.Value ? string.Empty : dr["column_value"]).ToString();
            object_type = (dr["object_type"] == DBNull.Value ? string.Empty : dr["object_type"]).ToString();
            object_name = (dr["object_name"] == DBNull.Value ? string.Empty : dr["object_name"]).ToString();
            Utilities.IsGuid((dr["object_package_guid"] == DBNull.Value ? string.Empty : dr["object_package_guid"]).ToString(), out object_package_guid);
        }
    }
}
